<!-- Start Live Search by hieubd -->
<div class="block">
   	<form class="searchform" action="" >
        <input id="livesearch" type="text" onblur="if (this.value == '') {this.value = 'Live Search...';}" onfocus="if (this.value == 'Live Search...') {this.value = '';}" value="Live Search..." class="searchfield" />
    </form>
</div>
<!-- End Live Search -->

<!-- Start SideBar by hieubd -->             
<ul id="sidebar-nav">
	<li><a href="#">Links</a>
		<ul class="drop" style="<?php if($this->controller == 'link') echo 'display: block;' ?>">
  			<li><a href="/admin/link/index"><img src="/images/adminbase/icons/16/comments.png"/>Manage Links</a></li>
			<li><a href="/admin/link/add"><img src="/images/adminbase/icons/16/comment_add.png"/>Add Link</a></li>
            <li><a href="/admin/link/manual-add"><img src="/images/adminbase/icons/16/comment_add.png"/>Manual Add</a></li>
		</ul>
	</li>
	<li><a href="#">User</a>
		<ul class="drop" style="<?php if($this->controller == 'user') echo 'display: block;' ?>">
  			<li><a href="/admin/user/index"><img src="/images/adminbase/icons/16/user.png"/>Management user</a></li>
		</ul>
	</li>
    <li><a href="#">Category</a>
		<ul class="drop" style="<?php if($this->controller == 'category') echo 'display: block;' ?>">
  			<li><a href="/admin/category/index"><img src="/images/adminbase/icons/16/comments.png"/>Management Category</a></li>
		</ul>
	</li>
    <li><a href="#">Area</a>
		<ul class="drop" style="<?php if($this->controller == 'area') echo 'display: block;' ?>">
  			<li><a href="/admin/area/index"><img src="/images/adminbase/icons/16/comments.png"/>Management Area</a></li>
		</ul>
	</li>
    <li><a href="#">Type</a>
		<ul class="drop" style="<?php if($this->controller == 'type') echo 'display: block;' ?>">
  			<li><a href="/admin/type/index"><img src="/images/adminbase/icons/16/comments.png"/>Management Type</a></li>
		</ul>
	</li>
    <li><a href="#">Card</a>
		<ul class="drop" style="<?php if($this->controller == 'card') echo 'display: block;' ?>">
  			<li><a href="/admin/card/index"><img src="/images/adminbase/icons/16/comments.png"/>Management Card</a></li>
		</ul>
	</li>
    <li><a href="#">Thanh toán</a>
		<ul class="drop" style="<?php if($this->controller == 'pay') echo 'display: block;' ?>">
  			<li><a href="/admin/pay/index"><img src="/images/adminbase/icons/16/comments.png"/>Thanh toán tiền</a></li>
		</ul>
	</li>
    <li><a href="#">Đối tác</a>
		<ul class="drop" style="<?php if($this->controller == 'doitac') echo 'display: block;' ?>">
  			<li><a href="/admin/doitac/index"><img src="/images/adminbase/icons/16/user.png"/>Management Đối tác</a></li>
		</ul>
	</li>
    <li><a href="#">Nội dung trang</a>
		<ul class="drop" style="<?php if($this->controller == 'content') echo 'display: block;' ?>">
  			<li><a href="/admin/content/about"><img src="/images/adminbase/icons/16/user.png"/>Trang giới thiệu</a></li>
            <li><a href="/admin/content/instruction"><img src="/images/adminbase/icons/16/user.png"/>Trang hướng dẫn</a></li>
            <li><a href="/admin/content/policy"><img src="/images/adminbase/icons/16/user.png"/>Trang chính sách</a></li>
            <li><a href="/admin/content/home"><img src="/images/adminbase/icons/16/user.png"/>Trang chủ</a></li>
		</ul>
	</li>
    <li><a href="#">Gửi thư cho user</a>
		<ul class="drop" style="<?php if($this->controller == 'mail') echo 'display: block;' ?>">
  			<li><a href="/admin/mail/index"><img src="/images/adminbase/icons/16/user.png"/>Danh sách thư</a></li>
            <li><a href="/admin/mail/create-mail"><img src="/images/adminbase/icons/16/user.png"/>Tạo thư</a></li>
		</ul>
	</li>
    <li><a href="#">Widget</a>
		<ul class="drop" style="<?php if($this->controller == 'widget') echo 'display: block;' ?>">
  			<li><a href="/admin/widget/index"><img src="/images/adminbase/icons/16/comments.png"/>Management Widget</a></li>
		</ul>
	</li>
</ul>
<!-- End SideBar -->
<br class="cl" /> 
<script type="text/javascript">
//Menu sidebar
$('#sidebar-nav > li > a').click(function(){
	    if ($(this).attr('class') != 'active'){
	      $('#sidebar-nav li ul').slideUp();
	      $(this).next().slideToggle();
	      $('#sidebar-nav li a').removeClass('active');
	      $(this).addClass('active');
	    }else{
	       $('#sidebar-nav li ul').slideUp();
           $('#sidebar-nav li a').removeClass('active');
	    }
         return false;
	  });
//jQuery UI - Live Search
$(function() {
		var availableTags = ["dashboard", "site", "manage site", "edit site", "delete site",
			             	 "admin", "manage admin", "edit admin", "delete admin", "statistics", 
			             	 "products", "edit product", "delete product", "manage products"
			             	];
		$("#livesearch").autocomplete({
			source: availableTags,
			select: function(event, ui) {
				var data = 'keyword='+ui.item.value;
				//alert(data);
		 	    var url = "/admin/autocomplete/search";
		 		$.ajax({
		 			url: url,
		 			type: 'POST',
		 			data: data,
		 			success: function(result){
		 				//window.location=result;
		 				//alert(result);
		 				window.location.assign(result);
		 			},
		 			error: function (){
		 				alert('Có lỗi xảy ra');
		 			}
		 		});
			}
		});
});	
</script>
